package com.my.search.controller.v1;

import com.my.model.common.dtos.ResponseResult;
import com.my.search.service.ApUserSearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api/v1/history")
public class ApUserSearchController {
    @Autowired
    private ApUserSearchService apUserSearchService;

    /**
     * 加载用户历史搜索信息
     * @return
     */
    @PostMapping("/load")
    public ResponseResult loadHistory() {
        return apUserSearchService.loadHistory();
    }

    /**
     * 删除历史记录
     * @param map
     * @return
     */
    @PostMapping("/del")
    public ResponseResult delHistory(@RequestBody Map map) {
        return apUserSearchService.delHistory(map);
    }
}
